<template>
	<view class="content">
		<!-- <video-list v-if="videoArray.length != 0" @setFollow='setFollow' :area='location' :isFlag='isFlag' :allList='videoArray' :playIndex='playIndex' @updateList='bottomScroll' :videoArray='List'></video-list> -->
		<videonues v-if="isFlag" :cateId='cateId' @setFollow='setFollow' :area='location' :isFlag='isFlag' :allList='videoArray' :playIndex='playIndex' @updateList='bottomScroll' :videoArray='List'></videonues>
	</view>
</template>

<script>
	import videoList from "../video/videoList.vue"
	import videonue from '../../components/video/videonvue.nvue'
	import videonues from '../../components/video/videonvues.nvue'
	import * as utils from '../../utils/index.js'
	export default {
		data(){
			return {
				actIndex:-1,
				cateId: 0,
				location:{},
				page:1,
				List:[],
				isFlag:true,
				playIndex: 0,
				loadingType:0,
				isBoolean: 1,
				videoArray:[],
				shop_id:''
			}
		},
		onLoad(options) {
			this.page = options.page
			this.circle_id = options.circleId
			this.playIndex = options.index
			this.videoArray = this.$store.getters.getPlayList
			this.List = this.videoArray
			this.cateId = options.cateId
			uni.setNavigationBarTitle({
				title:options.name
			})
			console.log(this.videoArray,parseInt(this.playIndex))
		},
		mounted() {
			// this.getList(1)
		},
		methods:{
			setFollow(id){
				console.log()
				this.List = this.List.map(item=>{
					if(item.shop_id == id){
						console.log(item)
						item.is_follow = item.is_follow == 0 ? 1:0
					}
					return item
				})
			},
			getList(page){
				this.$http.getcircle_video({
					 circle_id:this.circle_id,
					 page,
					 cate_id:  this.cateId|| 0
				}).then(res=>{
					 if(res.status == 200){
						 this.List = res.data.video_list
						 this.videoArray = this.videoArray.concat(res.data)
						 if(res.data.length == 0){
							 this.page = --this.page
							 this.loadingType = 2
						 }
						 this.loadingType = 0
						 
					 }
					 uni.hideLoading()
				})
			},
			bottomScroll(){
					this.loadingType = 1
					this.getList(++this.page)
			}
		},
		components: {
			videoList,
			videonue,
			videonues
		},
	}
</script>

<style lang="scss" scoped>
	.content {
		width: 100%;
		height: 100%;
		overflow: hidden;
		color: #3F536E;
		background-color: #000000;
		.title {
			margin: 0 20rpx;
		}
	}
	.scroll_box{
		height: calc(100vh - 288rpx);
		// margin-top: ;
		width: 94vw;
		margin: 288rpx 3vw;
	}
</style>
